package com.basksoft.baskreport.demo.dataset;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.math.RandomUtils;

import com.basksoft.report.core.model.dataset.BeanDataset;
import com.basksoft.report.core.model.dataset.impl.BeanContext;
import com.basksoft.report.core.model.dataset.impl.Field;
import com.basksoft.report.core.model.dataset.impl.FieldType;

public class CategoryCollectionDataset extends BeanDataset {
	private static List<Map<String,Object>> datas=new ArrayList<Map<String,Object>>();
	private static int i=0;
	@Override
	public List<?> getData(BeanContext context) {
		if (datas.size()==0) {
			for (int i=0; i<13; i++) {
				addData(i);
			}
		} else {
			datas.remove(0);
			addData(i);
			i++;
			if (i>=12) {
				i=0;
			}
		}
		return datas;
	}
	
	private void addData(int i) {
		Map<String, Object> data = null;
		if (i==0) {
			data = new HashMap<String, Object>();
			data.put("category", "抖音移动采集用户信息表");
			data.put("number", RandomUtils.nextInt(300000));
			datas.add(data);
		}
		else if (i==1) {
			data = new HashMap<String, Object>();
			data.put("category", "用户关联数据表");
			data.put("number", RandomUtils.nextInt(300000));
			datas.add(data);
		}
		else if (i==2) {
			data = new HashMap<String, Object>();
			data.put("category", "抖音用户统计数据表");
			data.put("number", RandomUtils.nextInt(300000));
			datas.add(data);
		}
		else if (i==3) {
			data = new HashMap<String, Object>();
			data.put("category", "抖音用户粉丝数据信息表");
			data.put("number", RandomUtils.nextInt(300000));
			datas.add(data);
		}
		else if (i==4) {
			data = new HashMap<String, Object>();
			data.put("category", "抖音视频统计数据表");
			data.put("number", RandomUtils.nextInt(300000));
			datas.add(data);			
		}
		else if (i==5) {
			data = new HashMap<String, Object>();
			data.put("category", "抖音移动视频采集信息表");
			data.put("number", RandomUtils.nextInt(300000));
			datas.add(data);
		}
		else if (i==6) {
			data = new HashMap<String, Object>();
			data.put("category", "抖音视频原创音乐关联表");
			data.put("number", RandomUtils.nextInt(300000));
			datas.add(data);
		}
		else if (i==7) {
			data = new HashMap<String, Object>();
			data.put("category", "抖音原创音乐基础表");
			data.put("number", RandomUtils.nextInt(300000));
			datas.add(data);
		}
		else if (i==8) {
			data = new HashMap<String, Object>();
			data.put("category", "抖音视频评论信息表");
			data.put("number", RandomUtils.nextInt(300000));
			datas.add(data);
		}
		else if (i==9) {
			data = new HashMap<String, Object>();
			data.put("category", "抖音音乐评论信息表");
			data.put("number", RandomUtils.nextInt(300000));
			datas.add(data);
		}
		else if (i==10) {
			data = new HashMap<String, Object>();
			data.put("category", "抖音我的关注用户数据信息表");
			data.put("number", RandomUtils.nextInt(300000));
			datas.add(data);
		}
		else if (i==11) {
			data = new HashMap<String, Object>();
			data.put("category", "打卡位置信息统计表");
			data.put("number", RandomUtils.nextInt(300000));
			datas.add(data);
		}
		else if (i==12) {
			data = new HashMap<String, Object>();
			data.put("category", "抖音视频打卡位置关联表");
			data.put("number", RandomUtils.nextInt(300000));
			datas.add(data);	
		}
	}

	@Override
	public List<String> getDependCells() {
		return null;
	}

	@Override
	protected String name() {
		return "数据分类采集";
	}

	@Override
	public List<Field> getFields() {
		List<Field> fields = new ArrayList<Field>();
		fields.add(new Field("category", FieldType.String));
		fields.add(new Field("number", FieldType.Integer));
		return fields;
	}

}
